#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
	int n = 0;
	scanf("%d", &n);
	int t = n * n;
	int i = 1;
	while (t > 0)
	{
		for (1; i <= t; i++)
		{
			if (i > 1 && (i - 1) % n == 0)printf("\n");
			if (i < 10)printf("0%d", i);
			else printf("%d", i);
		}
		t--;
	}
	printf("\n\n");
	t = 1;
	i = 1;
	int m = n;
	while (m)
	{
		int x = n - i;
		for (int b=x; b > 0; b--)
		{
			printf("  ");
		}
		for (int a=i; a > 0; a--)
		{
			if (t < 10)printf("0%d", t);
			else printf("%d", t);
			t++;
		}
		i++;
		printf("\n");
		m--;
	}
}